home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / include / jar / zipfile.h < prev    next >
C/C++ Source or Header  |  2006-05-08  |  4KB  |  113 lines

  1. /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* ***** BEGIN LICENSE BLOCK *****
  3.  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4.  *
  5.  * The contents of this file are subject to the Mozilla Public License Version
  6.  * 1.1 (the "License"); you may not use this file except in compliance with
  7.  * the License. You may obtain a copy of the License at
  8.  * http://www.mozilla.org/MPL/
  9.  *
  10.  * Software distributed under the License is distributed on an "AS IS" basis,
  11.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12.  * for the specific language governing rights and limitations under the
  13.  * License.
  14.  *
  15.  * The Original Code is Mozilla Communicator client code, released
  16.  * March 31, 1998.
  17.  *
  18.  * The Initial Developer of the Original Code is
  19.  * Netscape Communications Corporation.
  20.  * Portions created by the Initial Developer are Copyright (C) 1998
  21.  * the Initial Developer. All Rights Reserved.
  22.  *
  23.  * Contributor(s):
  24.  *   Daniel Veditz <dveditz@netscape.com>
  25.  *
  26.  * Alternatively, the contents of this file may be used under the terms of
  27.  * either the GNU General Public License Version 2 or later (the "GPL"), or
  28.  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  29.  * in which case the provisions of the GPL or the LGPL are applicable instead
  30.  * of those above. If you wish to allow use of your version of this file only
  31.  * under the terms of either the GPL or the LGPL, and not to allow others to
  32.  * use your version of this file under the terms of the MPL, indicate your
  33.  * decision by deleting the provisions above and replace them with the notice
  34.  * and other provisions required by the GPL or the LGPL. If you do not delete
  35.  * the provisions above, a recipient may use your version of this file under
  36.  * the terms of any one of the MPL, the GPL or the LGPL.
  37.  *
  38.  * ***** END LICENSE BLOCK ***** */
  39.  
  40. #ifndef _zipfile_h
  41. #define _zipfile_h
  42. /* 
  43.  * This module implements a simple archive extractor for the PKZIP format.
  44.  *
  45.  * All functions return a status/error code, and have an opaque hZip argument 
  46.  * that represents an open archive.
  47.  *
  48.  * Currently only compression mode 8 (or none) is supported.
  49.  */
  50.  
  51.  
  52. #define ZIP_OK                 0
  53. #define ZIP_ERR_GENERAL       -1
  54. #define ZIP_ERR_MEMORY        -2
  55. #define ZIP_ERR_DISK          -3
  56. #define ZIP_ERR_CORRUPT       -4
  57. #define ZIP_ERR_PARAM         -5
  58. #define ZIP_ERR_FNF           -6
  59. #define ZIP_ERR_UNSUPPORTED   -7
  60. #define ZIP_ERR_SMALLBUF      -8
  61.  
  62. #ifdef STANDALONE
  63.  
  64. PR_BEGIN_EXTERN_C
  65.  
  66. /* Open and close the archive 
  67.  *
  68.  * If successful OpenArchive returns a handle in the hZip parameter
  69.  * that must be passed to all subsequent operations on the archive
  70.  */
  71. PR_EXTERN(PRInt32) ZIP_OpenArchive( const char * zipname, void** hZip );
  72. PR_EXTERN(PRInt32) ZIP_CloseArchive( void** hZip );
  73.  
  74.  
  75. /* Test the integrity of every item in this open archive
  76.  * by verifying each item's checksum against the stored
  77.  * CRC32 value.
  78.  */
  79. PR_EXTERN(PRInt32) ZIP_TestArchive( void* hZip );
  80.  
  81. /* Extract the named file in the archive to disk. 
  82.  * This function will happily overwrite an existing Outfile if it can.
  83.  * It's up to the caller to detect or move it out of the way if it's important.
  84.  */
  85. PR_EXTERN(PRInt32) ZIP_ExtractFile( void* hZip, const char * filename, const char * outname );
  86.  
  87.  
  88. /* Functions to list the files contained in the archive
  89.  *
  90.  * FindInit() initializes the search with the pattern and returns a find token, 
  91.  * or NULL on an error.  Then FindNext() is called with the token to get the 
  92.  * matching filenames if any. When done you must call FindFree() with the 
  93.  * token to release memory.
  94.  * 
  95.  * a NULL pattern will find all the files in the archive, otherwise the 
  96.  * pattern must be a shell regexp type pattern.
  97.  *
  98.  * if a matching filename is too small for the passed buffer FindNext()
  99.  * will return ZIP_ERR_SMALLBUF. When no more matches can be found in
  100.  * the archive it will return ZIP_ERR_FNF
  101.  */
  102. PR_EXTERN(void*) ZIP_FindInit( void* hZip, const char * pattern );
  103. PR_EXTERN(PRInt32) ZIP_FindNext( void* hFind, char * outbuf, PRUint16 bufsize );
  104. PR_EXTERN(PRInt32) ZIP_FindFree( void* hFind );
  105.  
  106.  
  107. PR_END_EXTERN_C
  108.  
  109. #endif /* STANDALONE */
  110.  
  111.  
  112. #endif /* _zipfile_h */
  113.